﻿using _4.PersonTask.Model;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace PersonTask.Test
{
    [TestClass()]
    public class PersonTest
    {
        [TestMethod()]
        public void PersonConstructorTest()
        {
            string name = "pesho";
            Person target = new Person(name);
            Assert.IsTrue(target.Name == name && 
                !target.Age.HasValue);
        }
        
        [TestMethod()]
        public void PersonConstructorTest1()
        {
            string name = "pesho";
            int age = 67;
            Person target = new Person(name, age);
            Assert.IsTrue(target.Name == name &&
                target.Age.HasValue && 
                target.Age.Value == age);
        }
                
        [TestMethod()]
        public void AgeTest()
        {
            string name = "pesho";
            Person target = new Person(name);
            int? expected = 0;
            target.Age = 0;            
            Assert.AreEqual(expected, target.Age);            
        }
        
        [TestMethod()]
        public void NameTest()
        {
            string name = "pesho";
            Person target = new Person(name); 
            string expected = "kiro";
            target.Name = expected;
            string actual = target.Name;
            Assert.AreEqual(expected, actual);            
        }        
    }
}
